

from base import Base
from selenium.webdriver.common.by import By
from time import sleep


# 定义页面类，继承基类
class XueXiPage(Base):

    fangdajing = (By.XPATH, '//android.widget.ImageView[@resource-id="cn.xuexi.android:id/img_search_left"]')
    ershida = (By.XPATH, '//android.widget.TextView[@text="二十大报告"]')

    dy = (By.XPATH, '//android.view.View[@text="全部"]')

    def sousuoyewu(self):
        # 定位放大镜，并点击
        self.find_ele(self.fangdajing).click()
        sleep(3)
        # 定位 二十大报告 并点击
        self.find_ele(self.ershida).click()
        sleep(3)


    sanhanggang = (By.XPATH, '/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.LinearLayout/android.widget.FrameLayout[2]/android.widget.FrameLayout[1]/androidx.viewpager.widget.ViewPager/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.ImageView')
    yaowen = (By.XPATH,'//android.widget.TextView[@text="要闻"]')

    dy_toutiao = (By.XPATH, '//android.widget.TextView[@text="头条"]')

    def yaowenyewu(self):
        # 定位三行杠，并点击
        self.find_ele(self.sanhanggang).click()
        sleep(2)
        # 定位要闻，点击
        self.find_ele(self.yaowen).click()
        sleep(3)


